package com.ruoyi.system.service.aggregation.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.aggregation.Product;
import com.ruoyi.system.mapper.aggregation.ProductMapper;
import com.ruoyi.system.service.aggregation.IProductService;

/**
 * 商品Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-01-01
 */
@Service
public class ProductServiceImpl implements IProductService 
{
    @Autowired
    private ProductMapper productMapper;

    @Override
    public Product selectProductById(Long id)
    {
        return productMapper.selectProductById(id);
    }

    @Override
    public List<Product> selectProductList(Product product)
    {
        return productMapper.selectProductList(product);
    }

    @Override
    public List<Product> selectProductByMerchantId(Long merchantId)
    {
        return productMapper.selectProductByMerchantId(merchantId);
    }

    @Override
    public int insertProduct(Product product)
    {
        product.setCreateTime(DateUtils.getNowDate());
        product.setDeleted(0);
        return productMapper.insertProduct(product);
    }

    @Override
    public int updateProduct(Product product)
    {
        product.setUpdateTime(DateUtils.getNowDate());
        return productMapper.updateProduct(product);
    }

    @Override
    public int deleteProductById(Long id)
    {
        return productMapper.deleteProductById(id);
    }
}

